function sendSingle() {

    var uid = $('#targetUid').val();
    if (!uid || uid.length === 0) {
        $.modal({ body: '请输入有效的用户ID' });
        return;
    }
    var title = $('#singleEmailTitle').val();
    if (!title || title.length === 0) {
        $.modal({ body: '请输入邮件标题' });
        return;
    }
    var content = $('#singleEmailContent').val();
    if (!content || content.length === 0) {
        $.modal({ body: '请输入邮件内容' });
        return;
    }


    Swal.fire({
        title: '操作无法撤销，是否确定发送？',
        // text: "是否确定要批量添加选中文章？",
        icon: 'question',
        showCancelButton: true,
        confirmButtonColor: '#198754',
        cancelButtonColor: '#d93444',
        confirmButtonText: '确定',
        cancelButtonText: '取消'
    }).then((result) => {
        if (result.isConfirmed) {
            apiSendSingleEmail(uid, title, content, function (data) {
                if (data.code === 0) {
                    $.modal({ body: '发送成功' });
                }
            });
        }
    })
}

function sendServerEmail() {

    var title = $('#allEmailTitle').val();
    if (!title || title.length === 0) {
        $.modal({ body: '请输入邮件标题' });
        return;
    }
    var content = $('#allEmailContent').val();
    if (!content || content.length === 0) {
        $.modal({ body: '请输入邮件内容' });
        return;
    }

    Swal.fire({
        title: '操作无法撤销，是否确定发送？',
        // text: "是否确定要批量添加选中文章？",
        icon: 'question',
        showCancelButton: true,
        confirmButtonColor: '#198754',
        cancelButtonColor: '#d93444',
        confirmButtonText: '确定',
        cancelButtonText: '取消'
    }).then((result) => {
        if (result.isConfirmed) {
            apiSendAllServerEmail(title, content, function () {
                $.modal({ body: '全服邮件发送成功' });
            });
        }
    })

}

